<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
function checkInput(){
	var form = document.form;
	if(!form.title.value){
		alert("제목을 입력하세요...");
		form.title.focus();
		return false;
	}
	if(!form.content.value){
		alert("내용을 입력하세요...");
		form.content.focus();
		return false;
	}
	
	//사진 파일 체크
	var fileName = form.upfile.value;
	if(fileName!=""){
		var ext = fileName.substring(fileName.lastIndexOf(".")+1);
		if(ext!="jpg"&&ext!="png"&&ext!="jpeg"&&ext!="bmp"&&ext!="gif"){
			alert("그림파일만 업로드 가능합니다.");
			return false;
		}
	}
	form.submit();
}

</script>
</head>
<body>
<h3>글쓰기</h3>
<form action="writeContent.do" method="post" name="form" enctype="multipart/form-data" >
<input type="hidden" name="mode"  value="writeContentController">
<table >
	<tr>
		<td>제목 </td><td><input type="text" name="title" maxlength="150" size="50"></td>
	</tr>
	<tr>
		<td>작성자</td><td>${sessionScope.login_info.id }</td>
		
	</tr>
	<tr>
		<td colspan="2"><textarea name="content" cols="50" rows="5"></textarea></td>
	</tr>
	<tr>
			<td>사진 </td>
			<td>
				<input type="file" name="upfile">
			</td>
		</tr>
	<tr>
		<td align="center" colspan="2"><img src="img/confirm.gif"  style="cursor:pointer" onclick="checkInput()">
		<img src="img/cancel.gif" style="cursor: pointer">
		</td>
	</tr>
</table>
</form>
</body>
</html>